package com.imm.persistencia;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

final class DBConn {


	static Connection DataSourceCon() {
		Connection con = null;

		try {
			InitialContext ic = new InitialContext();
			DataSource ds = (DataSource) ic.lookup("java:MySqlDS");
			
			con = ds.getConnection();
			return con;
		
		}catch(NamingException e ){
			System.out.println(e.getMessage());
		
		}catch(SQLException e){
			System.out.println(e.getMessage());
		}
		return con;
	}
	
}	
